using System;
using System.Collections;
using System.Globalization;
using Sedna.Core.Controller;
using Sedna.Core.Controls.Actions.Support;
using Sedna.Core.Controls.Support;
using Nullables;

namespace Sedna.Core.Controls
{
	/// <summary>
	/// Summary description for EnterPopupButton.
	/// </summary>
	public class EnterPopupButton: BasePopupButton
	{
	    
	    
	
		public string Value
		{
			get 
			{
                string value = null;
				if (values.Count!=0)
				{
                    value = (string)values[0];	
				}
                return value;
//			    return Configuration.DataParser.Translate(this, value);
			}
			set
			{
//                string newValue = (string)Configuration.DataTranslator.Translate(this, value);
				if (values.Count==0)
				{
                    values.Add(value);	
				}
			    else
				{
                    values[0] = value;
				}
			}
		}


		public EnterPopupButton(IConfiguration configuration) : base(configuration)
		{
			Text="...";
		}

		protected override void Unbind()
		{
            binder.Unbind("Value", Configuration.DataParser);
			binder.Unbind("Enabled");
		}

		protected override void Bind()
		{
			binder.Bind(new string[]{"Visible", "Enabled"});
            binder.Bind("Value", Configuration.DataTranslator);
			Enabled=Enabled&&configuration.IsEnabledForPrincipal();
			Visible=Visible&&configuration.IsVisibleForPrincipal();
		}


	}
}
